"""添加第三类球类项目
足球、排球、篮球、网球、羽毛球、乒乓球
"""


def three_football(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """足球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 40.9:
                    return 120
                elif student_test2__grade <= 44.5:
                    return 120 - ((student_test2__grade - 40.9)/0.9)*5
                elif student_test2__grade <= 68.5:
                    return 100 - ((student_test2__grade - 44.5)/1.2)*5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 42.9:
                    return 120
                elif student_test2__grade <= 46.5:
                    return 120 - ((student_test2__grade - 42.9) / 0.9) * 5
                elif student_test2__grade <= 70.5:
                    return 100 - ((student_test2__grade - 46.5) / 1.2) * 5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【足球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【足球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None


def three_volleyball(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """排球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 16.8:
                    return 120
                elif student_test2__grade <= 22.9:
                    return 120 - ((student_test2__grade - 16.8) / 1.6) * 5
                elif student_test2__grade <= 58.9:
                    return 100 - ((student_test2__grade - 22.9) / 1.8) * 5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 18.8:
                    return 120
                elif student_test2__grade <= 24.9:
                    return 120 - ((student_test2__grade - 18.8) / 1.6) * 5
                elif student_test2__grade <= 60.9:
                    return 100 - ((student_test2__grade - 24.9) / 1.8) * 5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【排球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【排球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None


def three_basketball(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """篮球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 14:
                    return 120
                elif student_test2__grade <= 24:
                    return 120 - ((student_test2__grade - 14) / 2.5) * 5
                elif student_test2__grade <= 64:
                    return 100 - ((student_test2__grade - 24) / 2) * 5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade <= 18:
                    return 120
                elif student_test2__grade <= 28:
                    return 120 - ((student_test2__grade - 18) / 2.5) * 5
                elif student_test2__grade <= 68:
                    return 100 - ((student_test2__grade - 28) / 2) * 5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【篮球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【篮球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None


def three_tennis(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """网球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 25:
                    return 120
                elif student_test2__grade > 1:
                    return 120 - (25 - student_test2__grade)*5
                # elif student_test2__grade >= 5.4:
                #     return 110 - ((9.4 - student_test2__grade)/0.2)*5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 25:
                    return 120
                elif student_test2__grade > 1:
                    return 120 - (25 - student_test2__grade) * 5
                # elif student_test2__grade >= 5.4:
                #     return 110 - ((9.4 - student_test2__grade)/0.2)*5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【网球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【网球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None


def three_badminton(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """羽毛球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 50:
                    return 120
                elif student_test2__grade >= 46:
                    return 120 - (50 - student_test2__grade)*5
                elif student_test2__grade >= 8:
                    return 100 - ((46 - student_test2__grade)/2)*5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 50:
                    return 120
                elif student_test2__grade >= 46:
                    return 120 - (50 - student_test2__grade) * 5
                elif student_test2__grade >= 8:
                    return 100 - ((46 - student_test2__grade) / 2) * 5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【羽毛球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【羽毛球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None


def three_ping_pong(student_test2__grade, student_cell, xlsx_name, sheet_now, student_gender):
    """乒乓球"""
    try:
        if student_gender == "男":
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 34:
                    return 120
                elif student_test2__grade >= 26:
                    return 120 - (34 - student_test2__grade)*5
                elif student_test2__grade >= 20:
                    return 80 - ((26 - student_test2__grade)/2)*5
                elif student_test2__grade >= 8:
                    return 65 - ((20 - student_test2__grade)/1)*5
                else:
                    return 0
        else:
            if type(student_test2__grade) == int or type(student_test2__grade) == float:
                # print(f'这个{xlsx_name,student_cell}成绩整数或者小数：', student_test2__grade)
                if student_test2__grade >= 34:
                    return 120
                elif student_test2__grade >= 26:
                    return 120 - (34 - student_test2__grade) * 5
                elif student_test2__grade >= 20:
                    return 80 - ((26 - student_test2__grade) / 2) * 5
                elif student_test2__grade >= 8:
                    return 65 - ((20 - student_test2__grade) / 1) * 5
                else:
                    return 0
        if student_test2__grade is None:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【实心球】,成绩为空！！！")
            return None
        else:
            print(f"【{xlsx_name}】工作簿,【{sheet_now}】工作表,第【{student_cell}】行,【实心球】,【{student_test2__grade}】,数据错误！！！！！！")
            return None
    except Exception as e:
        # print(e)
        print(f"【{xlsx_name}】,【{sheet_now}】，第【{student_cell}】,【{student_test2__grade}】错误")
        return None
